import Vue from 'vue';
import Vuex from 'Vuex';

Vue.use(Vuex);

const ip = "//api.iliulan.com";
const stores = {
	debug: true,
	state:{
		app:{
			appName: 'Vue Demo',
			title: 'Home',
			showTip: true,
			type: 'home',
			commonUpdateShow: false,
			startTime:0,
			endTime:0,
			endval:0,
			altime:0,
			Lnum:0,
			calcspeed:0,
			progress:0,
			ajaxProgress:0,
			error:0,
			currentType:'wait',
			isShowTip: false,
			currentUser:{},
			isLogin:false,
			isMobile:true
		},
		api:{
			getRecommendNews: ip+"/recommendnews",
			getSearchNews: ip+"/search",
			getHomeKey: ip+"/recommendkey",
			getBeforeKeys: ip+"/beforekeys",
			getSearchHotKeys: ip+"/searchhotkeys",
			getAdsList: ip+"/gettaobaopopdata",
			postSignin: ip+"/signin",
			postSignUp: ip+"/createaccount",
			postSignOut: ip+"/signout",
			postForgotPassword: ip+"/forgotpassword",
			getUserInfo: ip+"/getuserinfo",
			getUserGoods: ip+"/getusergoods",
			postAddGoods: ip+"/addgood",
			postDelGoods: ip+"/delgood",
			getUserMessage: ip+"/usermessage",
			getFollowerMessage: ip+"/getfollowermessage",
			postAddFollow: ip+"/addfollow",
			postDelFollow: ip+"/delfollow",
			getNewsContent: ip+"/news",
			getSourceNews: ip+"/channel",
			postFyContent: ip+"/fy",
			isFollow: ip+"/isfollow",
			getFollowUsers: ip+"/getfollowusers",
			getFollowerUsers: ip+"/getfollowerusers",
			getVideos: ip+"/videos",
			getVideoInfo: ip+"/videoinfo",
			getChannels: ip+"/getChannels",
			getCountProps: ip+"/countprops?channel=${channel}&id=${id}&day=${day}"
		},
		home:{
			feedsData:[]
		},
		search:{
			feedsData:[]
		},
		channel:{
			feedsData:[],
			channel:{}
		}
	},
	mutations:{
		setAppState:function(state, v){
			extend(state.app, v);
		},
		setHomeData:function(state, v){
			extend(state.home, v);
		},
		setSearchData:function(state, v){
			extend(state.search, v);
		},
		setChannelData:function(state, v){
			extend(state.channel, v);
		}
	}
};

const store = new Vuex.Store(stores);

export default store;